home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Very Best of Atari Inside
/
The Very Best of Atari Inside 1.iso
/
mint
/
mntlib43
/
mntlib
/
fcntl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-09
|
571b
|
40 lines
/*
* fcntl() emulation for MiNT; written by Eric R. Smith and placed
* in the public domain
*/
#include <errno.h>
#include <mintbind.h>
#include <fcntl.h>
#include <stdarg.h>
#include <unistd.h>
extern int __mint; /* MiNT version */
#ifdef __STDC__
int fcntl (int f, int cmd, ...)
#else
int fcntl (f, cmd)
int f;
int cmd;
#endif
{
long r;
va_list argp;
va_start(argp, cmd);
if (__mint) {
r = Fcntl(f, va_arg(argp, void *), cmd);
if (r == -ELOCKED)
r = -EACCES;
}
else
r = -EINVAL;
if (r < 0) {
errno = (int) -r;
r = -1L;
}
return (int) r;
}